package com.fulin.desginpatten.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description 服务员
 * @Author fulin16
 * @Date 2020/12/10 16:27
 **/
public class Waitor {
    private List<Command> commands;

    public Waitor(){
        commands = new ArrayList<>();
    }

    public void setCommand(Command command){
        commands.add(command);
    }

    public void orderUp() throws InterruptedException {
        System.out.println("师傅,有新订单了");
        System.out.println("好的，马上准备菜");
        for(Command command : commands){
            command.execute();
        }
    }
}
